<html>
<head><meta charset="utf-8"><title>Conflicting impls in associated type bounds · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html">Conflicting impls in associated type bounds</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246253639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246253639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246253639">(Jul 16 2021 at 17:28)</a>:</h4>
<p>I don't understand how these two are conflicting, wouldn't the item have to be an array and a reference at the same time for that impl to overlap?</p>
<div class="codehilite"><pre><span></span><code>error[E0119]: conflicting implementations of trait `iter::traits::marker::TrustedLen` for type `iter::adapters::flatten::Flatten&lt;_&gt;`
   --&gt; library/core/src/iter/adapters/flatten.rs:264:1
    |
258 | / unsafe impl&lt;T, I, const N: usize&gt; TrustedLen for Flatten&lt;I&gt; where
259 | |     I: Iterator&lt;Item = [T; N]&gt; + TrustedLen
260 | | {
261 | | }
    | |_- first implementation here
...
264 | / unsafe impl&lt;&#39;a, T, I, const N: usize&gt; TrustedLen for Flatten&lt;I&gt; where
265 | |     I: Iterator&lt;Item = &amp;&#39;a [T; N]&gt; + TrustedLen
266 | | {
267 | | }
    | |_^ conflicting implementation for `iter::adapters::flatten::Flatten&lt;_&gt;`
</code></pre></div>



<a name="246256045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246256045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246256045">(Jul 16 2021 at 17:44)</a>:</h4>
<p>Looks like a variant of <a href="https://github.com/rust-lang/rust/issues/20400">https://github.com/rust-lang/rust/issues/20400</a></p>



<a name="246256159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246256159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246256159">(Jul 16 2021 at 17:45)</a>:</h4>
<p>you know you're in a fun place when you run into a pre-1.0 bug...</p>



<a name="246256414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246256414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246256414">(Jul 16 2021 at 17:47)</a>:</h4>
<p>This bug does get really annoying because <code>Fn() -&gt; T</code>, <code>Fn() -&gt; U</code> is considered overlapping.</p>



<a name="246256453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246256453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246256453">(Jul 16 2021 at 17:48)</a>:</h4>
<p>Maybe I can work around it in this case with a helper trait.</p>



<a name="246257897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Conflicting%20impls%20in%20associated%20type%20bounds/near/246257897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Conflicting.20impls.20in.20associated.20type.20bounds.html#246257897">(Jul 16 2021 at 17:59)</a>:</h4>
<p>it works. it wants a public trait but at least that can be made hidden and unstable. it only needed two layers of hacks <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>